package com.bianguo.android.functiondemo.item;

import android.widget.TextView;

import com.bianguo.android.functiondemo.R;
import com.zsd.android.recyclerviewlibrary.holder.RViewHolder;
import com.zsd.android.recyclerviewlibrary.listener.BaseRViewItem;

public class NormalItem extends BaseRViewItem<String> {

    @Override
    public int getItemLayout() {
        return R.layout.item_normal_layout;
    }

    @Override
    public boolean isItemView(String data, int position) {
        return position % 2 != 0;
    }

    @Override
    public void convertView(RViewHolder holder, String data, int position) {
        TextView tv = holder.getView(R.id.item_normal_tv);
        tv.setText(data);
        tv.setOnClickListener(view -> {
            if (onClickItemListener != null) {
                onClickItemListener.onClickItem(this, view, data, holder.getLayoutPosition());
            }
        });
    }
}
